package com.onlyphoto.onlymall.services

import android.app.IntentService
import android.content.Intent
import android.util.Log
import com.amap.api.location.AMapLocation
import com.onlyphoto.onlymall.MyApplication
import com.onlyphoto.onlymall.utils.ConfigUtil
import com.onlyphoto.onlymall.utils.LogUtil

/**
 * Created by gaochujia on 2019-6-27.
 */


class UploadLocationService : IntentService("location"){

    override fun onHandleIntent(p0: Intent?) {
        uploadLocation()
    }

    private fun uploadLocation() {
        Log.e("location-----", "uploadLocation: ")
        if (ConfigUtil.instance.loginStatus) {
            MyApplication.app.openGps(object : MyApplication.OnPosChanged {

                  override fun changed(location: AMapLocation) {
                        Log.e("location-----", "changed: ")
                        if (location.errorCode == 0) {
                            LogUtil.log("location", "位置移动了")
                        }
                    }
            }, false)
        }

    }
}